package com.smh.a05innerclassdemo5;

public class Test {
    public static void main(String[] args) {

        new Swim(){//new的是没有名字的类{}里面的是匿名类  继承
            @Override
            public void swim() {
                super.swim();
                System.out.println("重写swim");
            }
        }.swim();

        new Inter(){//new的是没有名字的类{}里面的是匿名类  实现

            @Override
            public void show() {
                System.out.println("重写接口方法");
            }
        }.show();

        method(new Swim(){
            @Override
            public void swim() {
                super.swim();
            }
        });

    }

    public static void method(Swim swim) {
        swim.swim();
    }
}
